package View;

import Model.Sach;
import dao.SachDAO;
import javax.swing.JFrame;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author TNT
 */
public class View extends JFrame {

    public View() {
//        FormChinh formChinh = new FormChinh();
//        add(formChinh);

//        FormHeThong formHeThong = new FormHeThong();
//        formHeThong.setVisible(true);

        ApplicationContext ctx =
                new ClassPathXmlApplicationContext("SpringServer.xml");
        SachDAO sDAO = (SachDAO) ctx.getBean("sachDao");
        Sach[] temp = new Sach[0];
        FormQuanLy formQuanLy = new FormQuanLy(sDAO.allBooks().toArray(temp));
        add(formQuanLy);

        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        setTitle("Quan Ly Sach");
        setSize(480, 600);
        setResizable(false);
        setLocationRelativeTo(getOwner());
        setVisible(true);
    }
    public static void main(String[] args) {
        View view = new View();
    }
}
